/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package define;

import java.awt.Graphics;
import java.net.*;
import java.util.Random;

/**
 *
 * @author CONGMAN
 */
public class PhongChoi extends game.GameObject{

    private int SoLuongNguoiChoi;
    private NguoiChoi[] dsNguoiChoi;
    private int VanHienTai;
    private TrangThaiPhongChoi TrangThaiHienTai;
    private LuotChoi Luot;
    private BoBai BB;
    private Socket Server;
    private Socket Client;


    public PhongChoi()
    {
        SoLuongNguoiChoi = 0;
        dsNguoiChoi = new NguoiChoi[SoLuongNguoiChoi];
        VanHienTai = 0;
        TrangThaiHienTai = TrangThaiPhongChoi.DangCho;
        Luot = new LuotChoi();
        Server = null;
        Client = null;
        BB = new BoBai();
    }

    public void KhoiTaoPhongChoi(int songuoichoi)
    {
        SoLuongNguoiChoi = songuoichoi;
        dsNguoiChoi = new NguoiChoi[SoLuongNguoiChoi];
        for(int i = 0 ; i < SoLuongNguoiChoi; i++)
        {
            dsNguoiChoi[i] = new NguoiChoi();
        }
    }

    public void ChiaBai()
    {
        BB = new BoBai();
        for(int i = 0; i < SoLuongNguoiChoi; i++)
        {
            for(int j = 0; j < 13; j ++)
            {
                int giatri = 0;
                int vitri = 0;
                Random r = new Random();
                vitri = r.nextInt(BB.getDsQuanBai().size());
                giatri = BB.getDsQuanBai().get(vitri);
                BB.getDsQuanBai().remove(vitri);
                dsNguoiChoi[i].getDsQuanBai()[j].setDoLon(giatri);
            }
        }
    }

    @Override
    public void draw(Graphics g)
    {}

    @Override
    public void update()
    {}
    /**
     * @return the SoLuongNguoiChoi
     */
    public int getSoLuongNguoiChoi() {
        return SoLuongNguoiChoi;
    }

    /**
     * @param SoLuongNguoiChoi the SoLuongNguoiChoi to set
     */
    public void setSoLuongNguoiChoi(int SoLuongNguoiChoi) {
        this.SoLuongNguoiChoi = SoLuongNguoiChoi;
    }

    /**
     * @return the dsNguoiChoi
     */
    public NguoiChoi[] getDsNguoiChoi() {
        return dsNguoiChoi;
    }

    /**
     * @param dsNguoiChoi the dsNguoiChoi to set
     */
    public void setDsNguoiChoi(NguoiChoi[] dsNguoiChoi) {
        this.dsNguoiChoi = dsNguoiChoi;
    }

    /**
     * @return the VanHienTai
     */
    public int getVanHienTai() {
        return VanHienTai;
    }

    /**
     * @param VanHienTai the VanHienTai to set
     */
    public void setVanHienTai(int VanHienTai) {
        this.VanHienTai = VanHienTai;
    }

    /**
     * @return the TrangThaiHienTai
     */
    public TrangThaiPhongChoi getTrangThaiHienTai() {
        return TrangThaiHienTai;
    }

    /**
     * @param TrangThaiHienTai the TrangThaiHienTai to set
     */
    public void setTrangThaiHienTai(TrangThaiPhongChoi TrangThaiHienTai) {
        this.TrangThaiHienTai = TrangThaiHienTai;
    }

    /**
     * @return the Luot
     */
    public LuotChoi getLuot() {
        return Luot;
    }

    /**
     * @param Luot the Luot to set
     */
    public void setLuot(LuotChoi Luot) {
        this.Luot = Luot;
    }

    /**
     * @return the Server
     */
    public Socket getServer() {
        return Server;
    }

    /**
     * @param Server the Server to set
     */
    public void setServer(Socket Server) {
        this.Server = Server;
    }

    /**
     * @return the Client
     */
    public Socket getClient() {
        return Client;
    }

    /**
     * @param Client the Client to set
     */
    public void setClient(Socket Client) {
        this.Client = Client;
    }

    /**
     * @return the BB
     */
    public BoBai getBB() {
        return BB;
    }

    /**
     * @param BB the BB to set
     */
    public void setBB(BoBai BB) {
        this.BB = BB;
    }
}
